package com.htjc.integral.activity.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.htjc.integral.activity.service.IIntegralSignInService;
import com.htjc.integral.common.annotation.InvokeLog;

/**
 * 签到活动的controller
 * @author hlc
 *
 */
@RestController
@RequestMapping(value = "/ad/signIn")
public class IntegralSignInController {
	
	@Autowired
	private IIntegralSignInService signInService;
	
	/**
	 * 进行签到
	 * @param json( IP	用户终端IP
	 *				VERIFY_CODE	是否通过验证//1正确0错误
	 *				UNION_ID	登录账户ID
	 *				CHANNEL_NO	渠道编码
	 *				USER_MOBILE 手机号)
	 * @return
	 */
	@InvokeLog(value="进行签到",params={"IP","VERIFY_CODE","UNION_ID","CHANNEL_NO","USER_MOBILE"})
	@RequestMapping(value = {"/marchSignIn"}, produces = {"text/json;charset=UTF-8;", "application/json;"})
	public String marchSignIn(@RequestBody String params){
		JSONObject json=JSONObject.parseObject(params);
		return signInService.marchSignIn(json).toString();
	}
	
	/**
	 * 获取签到天数
	 * @param json( IP	用户终端IP
	 *				CHANNEL_NO	渠道编码
	 *				UNION_ID	登录账户ID)
	 * @return
	 */
	@InvokeLog(value="获取签到天数",params={"IP","UNION_ID","CHANNEL_NO","MONTH"})
	@RequestMapping(value = {"/getSignedDays"}, produces = {"text/json;charset=UTF-8;", "application/json;"})
	public String getSignedDays(@RequestBody String params){
		JSONObject json=JSONObject.parseObject(params);
		return signInService.getSignedDays(json).toString();
	}
	
	
	/**
	 * 获取签到详情
	 * @param json( IP	用户终端IP
	 *				CHANNEL_NO	是否通过验证//1正确0错误
	 *				UNION_ID	登录账户ID
	 *				PAGE_SIZE	每页展示数量
	 *				PAGE		页码)
	 * @return
	 */
	@InvokeLog(value="获取签到详情",params={"IP","UNION_ID","CHANNEL_NO","PAGE_SIZE","PAGE"})
	@RequestMapping(value = {"/getSignDetail"}, produces = {"text/json;charset=UTF-8;", "application/json;"})
	public String getSignDetail(@RequestBody String params){
		JSONObject json=JSONObject.parseObject(params);
		return signInService.getSignDetail(json).toString();
	}
	
	/**
	 * 获取签到规则
	 * @param json( IP	用户终端IP
	 *				VERIFY_CODE	是否通过验证//1正确0错误
	 *				UN_ID	登录账户ID)
	 * @return
	 */
	@InvokeLog(value="获取签到规则")
	@RequestMapping(value = {"/getSignRules"}, produces = {"text/json;charset=UTF-8;", "application/json;"})
	public String getSignRules(@RequestBody String params){
		JSONObject json=JSONObject.parseObject(params);
		return signInService.getSignRules(json).toString();
	}
	
}
